Skip to content

Commit 7aeb9b5

Browse files
bakkotljharb
authored andcommitted
update detached buffer tests
1 parent 1933834 commit 7aeb9b5

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

test/built-ins/Uint8Array/prototype/setFromBase64/detached-buffer.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22
// This code is governed by the BSD license found in the LICENSE file.
33
/*---
44
esid: sec-uint8array.prototype.setfrombase64
5-
description: Uint8Array.prototype.setFromBase64 does not write to or error on detatched buffers
5+
description: Uint8Array.prototype.setFromBase64 throws on detatched buffers
66
includes: [detachArrayBuffer.js]
77
features: [uint8array-base64]
88
---*/
99

1010
var target = new Uint8Array([255, 255, 255]);
1111
$DETACHBUFFER(target.buffer);
12-
var result = target.setFromBase64('Zg==');
13-
assert.sameValue(result.read, 0);
14-
assert.sameValue(result.written, 0);
12+
assert.throws(TypeError, function() {
13+
target.setFromBase64('Zg==');
14+
});
1515

1616
var getterCalls = 0;
1717
var targetDetachingOptions = {};
@@ -23,7 +23,6 @@ Object.defineProperty(targetDetachingOptions, 'alphabet', {
2323
}
2424
});
2525
var target = new Uint8Array([255, 255, 255]);
26-
var result = target.setFromBase64('Zg==', targetDetachingOptions);
27-
assert.sameValue(getterCalls, 1);
28-
assert.sameValue(result.read, 0);
29-
assert.sameValue(result.written, 0);
26+
assert.throws(TypeError, function() {
27+
target.setFromBase64('Zg==', targetDetachingOptions);
28+
});

test/built-ins/Uint8Array/prototype/setFromHex/detached-buffer.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
// This code is governed by the BSD license found in the LICENSE file.
33
/*---
44
esid: sec-uint8array.prototype.setfromhex
5-
description: Uint8Array.prototype.setFromHex does not write to or error on detatched buffers
5+
description: Uint8Array.prototype.setFromHex throws on detatched buffers
66
includes: [detachArrayBuffer.js]
77
features: [uint8array-base64]
88
---*/
99

1010
var target = new Uint8Array([255, 255, 255]);
1111
$DETACHBUFFER(target.buffer);
12-
var result = target.setFromHex('aa');
13-
assert.sameValue(result.read, 0);
14-
assert.sameValue(result.written, 0);
12+
assert.throws(TypeError, function() {
13+
target.setFromHex('aa');
14+
});

0 commit comments

Comments
 (0)